package com.bang.study.config;

import com.bang.study.bean.LifeCode;
import com.bang.study.bean.Person;
import com.bang.study.filter.MyTypeFilter;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * @Auther: Bang
 * @Date: 2020/7/29 22:47
 * @Description:
 * <p>
 *     配置类
 * </p>
 */
@Configuration
@ComponentScan(
        value = "com.bang.study",
includeFilters =
        {
        @ComponentScan.Filter(type = FilterType.CUSTOM,classes = MyTypeFilter.class)
        },
useDefaultFilters = false)
public class AppConfig {

    @Bean(value = "person")
    @Primary
    public Person person() {
       return new Person("ZHANGSAN", 18);
    }

    @Bean(initMethod = "init",destroyMethod = "destory")
    public LifeCode lifeCode(){
        return new LifeCode();
    }

}
